#{extends '/templates/admin/admin-index.html'/}

#{set title:'功能列表' /}
#{set 'moreScripts'}
<script src="/tts/public/admin/sys/user.js"></script>
#{/set}

<div id="app" v-cloak>
    <!-- 数据列表 -->

    <!-- 数据列表 -->
    <div v-show="showList">
        <div class="grid-btn">
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            <a class="btn btn-primary" @click="invalid"><i class="fa fa-trash-o"></i>&nbsp;禁用</a>
            <a class="btn btn-primary" @click="valid"><i class="fa fa-bookmark-o"></i>&nbsp;启用</a>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>


    <!-- 新增表单 -->
    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">

            <div class="form-group">
                <div class="col-sm-2 control-label">用户名</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="user.userName" placeholder="用户名"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">姓名</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="user.name" placeholder="姓名"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">密码</div>
                <div class="col-sm-10">
                    <input type="password" class="form-control" v-model="user.password" placeholder="密码"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">用户类型</div>
                <label class="radio-inline">
                    <input type="radio" name="type" value="CUSTOMER" v-model="user.userType"/> 客户
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" value="DESIGNER" v-model="user.userType"/> 设计师
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" value="EXPERT" v-model="user.userType"/> 专家
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" value="ADMIN" v-model="user.userType"/> 平台管理员
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" value="SUPER_ADMIN" v-model="user.userType"/> 超级管理员
                </label>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">用户角色</div>
                <div class="col-sm-10">
                    <select class="form-control" data-placeholder="请选择角色" style="width: 100%;" tabindex="-1"
                            aria-hidden="true" v-model="user.role">
                        <option value="">全部</option>
                        <option v-for="item in roleList" :value="item.id">{{item.name}}</option>
                    </select>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>

</div>


